﻿function LoadItem(rows) {
    $("#hID").val(rows.ParaID);
    $('#hradio').val(rows.RType);
    $('#ParaNO').textbox('setValue', rows.ParaNO);
    $('#ParaName').textbox('setValue', rows.ParaName);
}
$(function () {
    // 使用window.location.href获取当前URL
    const url = new URL(window.location.href);
    // 使用URLSearchParams接口获取URL参数
    const params = new URLSearchParams(url.search);
    const pa = JSON.parse(decodeURIComponent(params.get('params')));
    // 初始化
    if (pa != null) {
        LoadItem(pa);
    } else {
        $('#ff').find('input.easyui-textbox').textbox('setValue', '');
    }
    if ($("#hradio").val() == "1") {
        $('#two').radiobutton({ checked: true });
    }
    else {
        $('#one').radiobutton({ checked: true });
    }
})
function submitForm() {
    var data;
    var url = "/api/SYS/SaveSysParaInfo";
    if (!$("#ff").form('enableValidation').form('validate')) {
        return;
    }
    var datalist = {
        ParaID: $("#hID").val(),
        ParaNO: $("#ParaNO").val(),
        ParaName: $("#ParaName").val(),
        RType: $('input:radio[name="fruit"]:checked').val()
    }
    DataService.PostJson(url, datalist, function (error, response) {
        if (error) {
            CloseWindowNotice("success");
        } else {
            Alert(response);
        }
    })
}
//重制
function clearForm() {
    $('#ff').form('clear');
}